package com.googlecode.microanalyst.palette.model.cmd;

import org.eclipse.gef.commands.Command;

import com.googlecode.microanalyst.palette.model.LabeledConnection;

public class LabeledConnectionLabelCommand extends Command {

	private String newLabel, oldLabel;
	private LabeledConnection connection;

	public LabeledConnectionLabelCommand(LabeledConnection l, String s) {
		connection = l;
		if (s != null)
			newLabel = s;
		else
			newLabel = ""; //$NON-NLS-1$
	}

	public void execute() {
		oldLabel = connection.getLabel();
		connection.setLabel(newLabel);
	}

	public void undo() {
		connection.setLabel(oldLabel);
	}

}
